import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/index.vue'
import Login from '../views/login/login.vue'
import RoleManagement from '../views/role-management/role-management.vue'//角色管理
import RolePermissions from '../views/role-management/role-permissions.vue'//角色权限
import PostType from '../views/role-management/post-type.vue'//岗位类型
import IncludeUsers from '../views/role-management/include-users.vue'//包含用户

import UserManagement from '../views/user-management/user-management.vue'//用户管理

import DepartmentManagement from '../views/department-management/department-management.vue'//部门管理
import OganizationalStructure from '../views/department-management/organizational-structure.vue'//组织架构

import OperationLog from '../views/operation-log/operation-log.vue'//操作日志
import WorksheetLog from '../views/operation-log/worksheet-log.vue'//工单日志
import InOutLog from '../views/operation-log/in-out-log.vue'//登录/退出日志
import TelephoneLog from '../views/operation-log/telephone-log.vue'//软电话日志
import SystemLog from '../views/operation-log/system-log.vue'//系统日志
import UserLog from '../views/operation-log/user-log.vue'//用户日志

import WorkOrderSearch from '../views/workOrderSearch/workOrderSearch'//工单查询
import WorkOrderPool from '../views/workOrderPool/workOrderPool'//工单池

import UserConfig from '../views/userConfig/user-config'//导入工单分类


import AddUser from '../views/addUser/addUser'//工单池

import UserList from '../views/userList/user-list'//用户列表

import CityArea from '../views/cityArea/cityArea'//用户列表

import ReleaseOrder from '../views/releaseOrder/releaseOrder'//未释放工单



const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'login',
        meta: {
        },
        component: Login
    },
    {
        path: '/index',
        name: 'index',
        meta: {
        },
        component: Index,
        // redirect:'/rolePermissions',
        children: [
            {
                path: '/roleManagement',
                name: 'roleManagement',
                meta: {
                    title: '角色管理',
                    from: '角色管理',
                },
                component: RoleManagement,
                // redirect:'/rolePermissions',
                children: [
                    {
                        path: '/rolePermissions',
                        name: 'rolePermissions',
                        meta: {
                            title: '角色权限',
                            from: '角色管理',
                            son: true
                        },
                        component: RolePermissions,
                    },
                    {
                        path: '/includeUsers',
                        name: 'includeUsers',
                        meta: {
                        },
                        component: IncludeUsers,
                    },
                    {
                        path: '/postType',
                        name: 'postType',
                        meta: {
                            title: '岗位类型',
                            from: '角色管理',
                            son: true
                        },
                        component: PostType,
                    }

                ]
            },
            {
                path: '/departmentManagement',
                name: 'departmentManagement',
                meta: {
                    title: '部门管理',
                    from: '部门管理',
                },
                component: DepartmentManagement,
                children: [
                    {
                        path: '/organizationalStructure',
                        name: 'organizationalStructure',
                        meta: {
                            title: '组织架构',
                            from: '部门管理',
                            son: true
                        },
                        component: OganizationalStructure,
                    },
                ]
            },
            {
                path: '/userManagement',
                name: 'userManagement',
                meta: {
                    title: '用户管理',
                    from: '用户管理',
                },
                component: UserManagement,
                children: [
                    // {
                    //   path: '/rolePermissions',
                    //     name: 'rolePermissions',
                    //     meta:{
                    //     },
                    //     component: RolePermissions,
                    // },
                    // {
                    //   path: '/includeUsers',
                    //     name: 'includeUsers',
                    //     meta:{
                    //     },
                    //     component: IncludeUsers,
                    // }
                ]
            },
            {
                path: '/operationLog',
                name: 'operationLog',
                meta: {
                    title: '操作日志',
                },
                component: OperationLog,
                // redirect :'/worksheetLog',
                children: [
                    {
                        path: '/worksheetLog',
                        name: 'worksheetLog',
                        meta: {
                            title: '工单日志'
                        },
                        component: WorksheetLog,
                    },
                    {
                        path: '/inOutLog',
                        name: 'inOutLog',
                        meta: {
                            title: '登录/退出日志'
                        },
                        component: InOutLog,
                    },
                    {
                        path: '/telephoneLog',
                        name: 'telephoneLog',
                        meta: {
                            title: '软电话日志'
                        },
                        component: TelephoneLog,
                    },
                    {
                        path: '/systemLog',
                        name: 'systemLog',
                        meta: {
                            title: '系统日志'
                        },
                        component: SystemLog,
                    },
                    {
                        path: '/userLog',
                        name: 'userLog',
                        meta: {
                            title: '用户日志'
                        },
                        component: UserLog,
                    },
                    // {
                    //   path: '/includeUsers',
                    //     name: 'includeUsers',
                    //     meta:{
                    //     },
                    //     component: IncludeUsers,
                    // }
                ]
            },
            {
                path: '/workOrderSearch',
                name: 'workOrderSearch',
                meta: {
                    title: '工单管理',
                    from: '工单管理',
                },
                component: WorkOrderSearch,
                // children:[
                //   {
                //     path: '/workOrderSearch',
                //       name: 'workOrderSearch',
                //       meta:{
                //         title:'工单查询',
                //         from:'工单管理',
                //         son:true
                //       },
                //       component:WorkOrderSearch,
                //   },
                // ]
            },
            {
                path: '/workOrderPool',
                name: 'workOrderPool',
                meta: {
                    title: '工单池',
                    from: '工单管理',
                },
                component: WorkOrderPool,
            },
            {
                path: '/releaseOrder',
                name: 'releaseOrder',
                meta: {
                    title: '未释放工单',
                    from: '未释放工单',
                },
                component: ReleaseOrder
            },
            {
                path: '/addUser',
                name: 'addUser',
                meta: {
                    title: '增加用户',
                    from: '工单管理',
                },
                component: AddUser,
            },
            {
                path: '/userConfig',
                name: 'userConfig',
                meta: {
                    title: '导入工单分类',
                    from: '导入工单分类',
                },
                component: UserConfig,
            },
            {
                path: '/userList',
                name: 'userList',
                meta: {
                    title: '用户列表',
                    from: '用户列表',
                },
                component: UserList,
            },
            {
                path: '/cityArea',
                name: 'cityArea',
                meta: {
                    title: '城市地区',
                    from: '城市地区',
                },
                component: CityArea,
            },

        ]
    },
    {
        path: '*',
        component: Index,
        redirect: '/index'
    }
    // {
    //   path: '/about',
    //   name: 'about',
    //   // route level code-splitting
    //   // this generates a separate chunk (about.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   // component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
    //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
    // }
]

const router = new VueRouter({
    routes
})

export default router
